class_name JumpState

extends IState


# 进入方法
func enter() -> void:
	characterCtr.play_character_anm(get_anm_name())

    
#退出方法
func exit() -> void:
	pass
    

#逻辑更新
func logic_update(_delta: float) -> void:

	var jumpRate: float = characterCtr.character_jump_speed_rate()
	if jumpRate > 0:
		characterCtr.character_horizontal_move(_delta, 0.8)
		var anmParam = floor(abs(jumpRate))
		characterCtr.play_character_anm_one_param(get_anm_name(), anmParam)
	else:
		stateMachine.switch_character_state(StateMachine.CharacterStates.FALL)


#物理更新
func physics_update(_delta: float) -> void:
	pass
    

func get_type() -> StateMachine.CharacterStates:
	return StateMachine.CharacterStates.JUMP


func get_anm_name() -> String:
	return "Jump"